import type {
  ProjectProgressAddDTOType,
  ProjectProgressSearchDTOType,
  ProjectProgressUpdateDTOType
} from '@/resources/interface/projectProgress/ProjectProgressTypes'
import type { TableColumn } from '@/components/CommonTable.vue'
import { ComponentEnum, type FormItemConfig } from '@/components/CommonDialogForm.vue'

/**
 * 毕设进度表 参数对象
 */
export class ProjectProgressParams {
  /**
   * 表单参数
   */
  static formColumn: FormItemConfig[] = [
    {
      label: '学生ID',
      prop: 'studentId',
      type: ComponentEnum.INPUT,
      field: 'studentId',
    },
    {
      label: '题目ID',
      prop: 'projectId',
      type: ComponentEnum.INPUT,
      field: 'projectId',
    },
    {
      label: '选题是否通过(0.通过，未通过)',
      prop: 'selectionPassed',
      type: ComponentEnum.INPUT,
      field: 'selectionPassed',
    },
    {
      label: '开题是否通过(0.通过，未通过)',
      prop: 'proposalPassed',
      type: ComponentEnum.INPUT,
      field: 'proposalPassed',
    },
    {
      label: '中期是否通过(0.通过，未通过)',
      prop: 'midtermPassed',
      type: ComponentEnum.INPUT,
      field: 'midtermPassed',
    },
    {
      label: '终期是否通过(0.通过，未通过)',
      prop: 'finalPassed',
      type: ComponentEnum.INPUT,
      field: 'finalPassed',
    },
    {
      label: '毕业材料是否通过(0.通过，未通过)',
      prop: 'graduationPassed',
      type: ComponentEnum.INPUT,
      field: 'graduationPassed',
    },
  ]
  /**
   * 表格参数
   */
  static tableColumn: TableColumn[] = [
    {
      label: '学生姓名',
      field: 'studentName',
    },
    {
      label: '题目名称',
      field: 'projectName',
    },
    {
      label: '选题申请',
      field: 'selectionPassed',
      formatter(row) {
        return row.selectionPassed === 0
          ? '未审核'
          : row.selectionPassed === 1
            ? '审核通过'
            : row.selectionPassed === 2
              ? '审核不通过'
              : '未提交'
      },
    },
    {
      label: '开题报告',
      field: 'proposalPassed',
      formatter(row) {
        return row.proposalPassed === 0
          ? '未审核'
          : row.proposalPassed === 1
            ? '审核通过'
            : row.proposalPassed === 2
              ? '审核不通过'
              : '未提交'
      },
    },
    {
      label: '中期答辩',
      field: 'midtermPassed',
      formatter(row) {
        return row.midtermPassed === 0
          ? '未审核'
          : row.midtermPassed === 1
            ? '审核通过'
            : row.midtermPassed === 2
              ? '审核不通过'
              : '未提交'
      },
    },
    {
      label: '终期答辩',
      field: 'finalPassed',
      formatter(row) {
        return row.finalPassed === 0
          ? '未审核'
          : row.finalPassed === 1
            ? '审核通过'
            : row.finalPassed === 2
              ? '审核不通过'
              : '未提交'
      },
    },
    {
      label: '毕业材料',
      field: 'graduationPassed',
      formatter(row) {
        return row.graduationPassed === 0
          ? '未审核'
          : row.graduationPassed === 1
            ? '审核通过'
            : row.graduationPassed === 2
              ? '审核不通过'
              : '未提交'
      },
    },
  ]
  /**
   * 添加对象
   */
  static addDTO: ProjectProgressAddDTOType = {
    studentId: 0,
    projectId: 0,
    selectionPassed: 0,
    proposalPassed: 0,
    midtermPassed: 0,
    finalPassed: 0,
    graduationPassed: 0,
  }
  /**
   * 修改对象
   */
  static updateDTO: ProjectProgressUpdateDTOType = {
    id: 0,
    studentId: 0,
    projectId: 0,
    selectionPassed: 0,
    proposalPassed: 0,
    midtermPassed: 0,
    finalPassed: 0,
    graduationPassed: 0,
  }
  /**
   * 查询对象
   */
  static searchDTO: ProjectProgressSearchDTOType = {
    studentName: '',
    projectName: '',
    page: {
      current: 1,
      size: 20,
    },
  }
}
